Trò chơi đua xe động vật trong UNITY Engine
114.839 lượt xem;
- ImportTiled2Unity.Texture.cs
- Editor /
- Scripts /
- Tiled2Unity /
- Assets /
- project /
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 using UnityEditor;
7 using UnityEngine;
8
9 namespace Tiled2Unity
10 {
11 // Handled a texture being imported
12 partial class ImportTiled2Unity
13 {
14 public void TextureImported(string texturePath)
15 {
16 // This is fixup method due to materials and textures, under some conditions, being imported out of order
17 Texture2D texture2d = AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D)) as Texture2D;
18 Material material = AssetDatabase.LoadAssetAtPath(ImportUtils.GetMaterialPath(texturePath), typeof(Material)) as Material;
19 material.SetTexture("_MainTex", texture2d);
20 }
21 }
22 }
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 using UnityEditor;
7 using UnityEngine;
8
9 namespace Tiled2Unity
10 {
11 // Handled a texture being imported
12 partial class ImportTiled2Unity
13 {
14 public void TextureImported(string texturePath)
15 {
16 // This is fixup method due to materials and textures, under some conditions, being imported out of order
17 Texture2D texture2d = AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D)) as Texture2D;
18 Material material = AssetDatabase.LoadAssetAtPath(ImportUtils.GetMaterialPath(texturePath), typeof(Material)) as Material;
19 material.SetTexture("_MainTex", texture2d);
20 }
21 }
22 }
Handled a texture being imported
This is fixup method due to materials and textures, under some conditions, being imported out of order